1 $(document).ready(function() {
2     
var win = $(window);
3
4     
// Each time the user scrolls
5     win.scroll(function() {
6         
// End of the document reached?
7         
if ($(document).height() - win.height() == win.scrollTop()) {
8             $(
'#loading').show();
9
10             $.ajax({
11                 url:
'get-post.php',
12                 dataType:
'html',
13                 success: function(html) {
14                     $(
'#posts').append(html);
15                     $(
'#loading').hide();
16                 }
17             });
18         }
19     });
20 });

21
22 /*HTML
23 <ul id=
"posts">
24     <li>
25         <article>content</article>
26     </li>
27
28     …
29 </ul>
30
31 <p id=
"loading">
32     <img src=
"images/loading.gif" alt="Loading…" />
33 </p>
34 */


Gõ tìm kiếm nhanh...